#ifndef TEXTURE_H_
#define TEXTURE_H_

class Image;

#include <map>
#include <string>

class Texture{

public:




	static Texture* loadFileTexture(const char *name);
	static Texture* loadImageTexture(Image *im);
	static Texture* loadCubeFileTexture(const char *faces[]);

	// note, does not clear image textures
	static void clearAllTextures();
	static void clearTexture(Texture *tex);


	static int getMemoryUsage(){
		return mem_usage;
	}

	static void saveBuffer(int width, int height, const char *name);

	unsigned int getId(){
		return texId;
	}

	unsigned int getTargetType(){
		return texType;
	}


private:

	Texture(const char *name);
	Texture(Image *im);
	Texture(const char *faces[]);
	~Texture();

	static void init();

	static bool inited;
	static int mem_usage;
	static std::map<std::string, Texture*> textures;

	int width;
	int height;
	int format;
	unsigned int texId, texType, references;
	int texPixelSize;


};


#endif /* TEXTURE_H_ */
